<?php



class TodaysDateAndTime
{
	
	/**
	 * @return string, tid , dag månad o år.
	 */
	public function GetTodaysDate()
	{
		$timeAndDate = $this->GetTimeAndDateArray();	


		$year = $timeAndDate['year'];	 
		$mday = $timeAndDate['mday'];	 // 1-31.
		$month = $this->GetTodaysMonthInSwedish();
	    $wday = $this->GetTodaysDayInSwedish(); 
		$time = $this->GetTime(); 
						
		
		return $wday . ", den " . $mday . " " . $month. " år "
		     . $year . ". Klockan är [" . $time . "].";
	}


	/**
	 * @return date obj 
	 */
	private function GetTimeAndDateArray()
	{
		return getdate();
	}

	/**
	 * @return string - veckodag
	 */
	private function GetTodaysDayInSwedish()
	{
		$timeAndDate = $this->GetTimeAndDateArray();
		$wday = $timeAndDate['wday'];
		// switch satser för dag
		switch($wday)
		{
			case 0:
				$wday = "Söndag";
				break;
				
			case 1:
				$wday = "Måndag";
				break;
				
			case 2:
				$wday = "Tisdag";
				break;
				
			case 3:
				$wday = "Onsdag";	
				break;
				
			case 4:
				$wday = "Torsdag";
				break;	
				
			case 5:
				$wday = "Fredag";
				break;
				
			case 6:
				$wday = "Lördag";
				break;		
		}
		return $wday;
	}
	
	/**
	 * @return string
	 */
	private function GetTodaysMonthInSwedish()
	{
		$timeAndDate = $this->GetTimeAndDateArray();
		$month = $timeAndDate['mon'];
		 
		switch($month)
		{
			case 1:
				$month = "Januari";
				break;
				
			case 2:
				$month = "Februari";
				break;
				
			case 3:
				$month = "Mars";
				break;
				
			case 4:
				$month = "April";	
				break;
				
			case 5:
				$month = "Maj";
				break;	
				
			case 6:
				$month = "Juni";
				break;
				
			case 7:
				$month = "Juli";
				break;		
				
			case 8:
				$month = "Augusti";
				break;
				
			case 9:
				$month = "September";	
				break;
				
			case 10:
				$month = "Oktober";
				break;	
				
			case 11:
				$month = "November";
				break;
				
			case 12:
				$month = "December";
				break;		
		}
		
		return $month;
		
	}
	
	/**
	 * @return string
	 */
	private function GetTime()
	{
		$dateAndTime = $this->getTimeAndDateArray();
		
		return $dateAndTime['hours']. ":" . $dateAndTime['minutes'].
		 ":" . $dateAndTime['seconds'];
		
	}
	


}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	